<%@include file="../../context.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Annual Share Data</title>
<%@include file="../common_Admin_imports.jsp"%>
<%@include file="../common_list_page.jsp"%>
<script type="text/javascript">
	$(document)
			.ready(
					function() {

						$(".datepicker")
								.datepicker(
										{
											changeMonth : true,
											changeYear : true,
											showButtonPanel : true,
											dateFormat : 'yy',
											onClose : function(dateText, inst) {
												var month = $(
														"#ui-datepicker-div .ui-datepicker-month :selected")
														.val();
												var year = $(
														"#ui-datepicker-div .ui-datepicker-year :selected")
														.val();
												$(this)
														.datepicker(
																'setDate',
																new Date(year,
																		month,
																		1));
											}
										});

						resetSelectAll();
						$('#selectAll').on('click', function() {
							selectAll();
						});
						paginationNextBtn("${pageContext.request.contextPath}/admin/annualsharedata/list.html?totalRecords=${annualShareDataPage.totalNoOfRecords}&page=");

					});

	function deleteFiltered() {
		var proceed = confirm("Are you sure, you want to delete the searched dataset ? If you select yes, the operation cannot be undone");
		if (proceed) {
			var baseUrl = "${pageContext.request.contextPath}/admin/annualsharedata/deleteFiltered.html";
			document.location = baseUrl;
		}

		return proceed;
	}
</script>
<style type="text/css">
.datepicker,.searchSelector {
	margin-right: 10px;
	width: 100px;
}

.searchSelector {
	margin-right: 10px;
	width: 150px;
}

.btnSerch {
	padding: 4px;
}
</style>
</head>
<body>
	<div class="main_wrapper">
		<div class="header_wrapper">
			<div class="container-fluid">
				<div class="header_inner_wrapper clearfix">
					<div class="row-fluid">
						<div class="header_left span4">List of Annual Data</div>
						<div class="header_right span8">
							<div class="input-append" style="float: right;">
								<!-- search section -->
								<form:form method="POST" commandName="criteria" id="form_id"
									action="${pageContext.request.contextPath}/admin/annualsharedata/search.html">
									<form:input cssClass="datepicker" path="fromYear"
										id="fromDatepicker" />
									<form:input cssClass="datepicker" path="toYear"
										id="toDatepicker" />
									<form:input onselect="" cssClass="searchSelector"
										list="companyNameList" path="companyName" />
									<input class="btnSerch btn-info" value="Search" type="submit" />
									<input id="reset_btn" class="btnSerch btn-info" type="button"
										value="Reset" />
								</form:form>
								<datalist id="companyNameList">
									<c:forEach items="${companyMap}" var="company">
										<option value="${company.name }" />
									</c:forEach>
								</datalist>
								<!-- end of search section -->							
							</div>
							<div><jsp:include page="../common_link.jsp" /></div>
						</div>
					</div>
				</div>
				<div class="row-fluid">
					<div class="main_table">
						<form:form method="POST"
							action="${pageContext.request.contextPath}/admin/annualsharedata/delete/selected.html">
							<table class="table table-bordered table-striped">
								<thead>
									<tr>
										<th id="tableHeader"><input type="checkbox"
											id="selectAll" name="deleteHeader" /></th>
										<th id="tableHeader">No</th>
										<th id="tableHeader">Year</th>
										<th id="tableHeader">Company</th>
										<th id="tableHeader">Net Profit</th>
										<th id="tableHeader">No of Shares</th>
										<th id="tableHeader">Revenue</th>
										<th id="tableHeader">EBITDA</th>
										<th id="tableHeader">Dividend</th>
										<th></th>
										<th></th>
									</tr>
								</thead>
								<tbody>
									<c:forEach var="annualShareData"
										items="${annualShareDataPage.pageData}">
										<tr>
											<td><input type="checkbox" class="selectedId"
												name="deleteIds" value="${annualShareData.id}" /></td>
											<td>${annualShareData.id}</td>
											<td id="dateAlign">${annualShareData.year}</td>
											<td>${annualShareData.company.name}</td>
											<td id="numberAlign"><fmt:formatNumber
													maxFractionDigits="${MaxFraction}"
													minFractionDigits="${MinFraction}"
													value="${annualShareData.netProfit}" /></td>
											<td id="numberAlign"><fmt:formatNumber
													maxFractionDigits="${MaxFraction}"
													minFractionDigits="${MinFraction}"
													value="${annualShareData.numberOfShares}" /></td>
											<td id="numberAlign"><fmt:formatNumber
													maxFractionDigits="${MaxFraction}"
													minFractionDigits="${MinFraction}"
													value="${annualShareData.revenues}" /></td>
											<td id="numberAlign"><fmt:formatNumber
													maxFractionDigits="${MaxFraction}"
													minFractionDigits="${MinFraction}"
													value="${annualShareData.ebitda}" /></td>
											<td id="numberAlign"><fmt:formatNumber
													maxFractionDigits="${MaxFraction}"
													minFractionDigits="${MinFraction}"
													value="${annualShareData.dividents}" /></td>
											<td><a class="btn btn-info"
												href="${pageContext.request.contextPath}/admin/annualsharedata/edit/${annualShareData.id}.html">Edit</a>
											</td>
											<td><a class="btn btn-danger"
												lang="${pageContext.request.contextPath}/admin/annualsharedata/delete/${annualShareData.id}.html"
												href="javascript:void(0);"
												onclick="return confirmAndDelete(this);">Delete</a></td>
										</tr>
									</c:forEach>
								</tbody>
							</table>
							<div>
								<div>
									<input
										onclick="return confirm('Are you sure, you want to delete all the selected results. This opperation cannot be undone');"
										class="btn btn-danger" type="submit" value="Delete Selected" />
									<input onclick="return deleteFiltered();"
										class="btn btn-danger" type="button"
										value="Delete Filtered List" />
								</div>
							</div>
						</form:form>
						<!-- paging section -->
						<div class="pagination pagination-right">
							<!-- page number -->
							Page&nbsp;<input value="${annualShareDataPage.currentPageNo}"
								style="width: 50px;" type="number" min="0"
								max="${annualShareDataPage.totalNoOfPages }" id="pageNum">
							<!-- end page number -->
							<ul>
								<li><c:if test="${annualShareDataPage.showPrev}">
										<a
											href="${pageContext.request.contextPath}/admin/annualsharedata/list.html?page=${annualShareDataPage.currentPageNo-1}&totalRecords=${annualShareDataPage.totalNoOfRecords}">Prev</a>
									</c:if></li>
								<c:forEach begin="${annualShareDataPage.startPageNo}" var="page"
									end="${annualShareDataPage.endPageNo}">
									<li><a
										<c:if test="${annualShareDataPage.currentPageNo==page}">style="background-color:#79BAEC"</c:if>
										href="${pageContext.request.contextPath}/admin/annualsharedata/list.html?page=${page}&totalRecords=${annualShareDataPage.totalNoOfRecords}">${page}</a></li>&nbsp;
							</c:forEach>
								<li><c:if test="${annualShareDataPage.showNext}">
										<a
											href="${pageContext.request.contextPath}/admin/annualsharedata/list.html?page=${annualShareDataPage.currentPageNo+1}&totalRecords=${annualShareDataPage.totalNoOfRecords}">Next</a>
									</c:if></li>
								<li><a class="pageCountLink">${annualShareDataPage.totalNoOfPages }
										Pages</a></li>
							</ul>

						</div>
						<div>
							<br></br>
						</div>
						<!-- paging section -->
						<a class="btn btn-success"
							href="${pageContext.request.contextPath}/admin/annualsharedata/add.html">New</a>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>